import { useI18n } from 'vue-i18n'
import { enableOptions, usedFlagOptionsSTR } from 'config/mockData'
import { getTenantId } from 'utils/headerToken'
// 租户配置-单据编码规则 新增/编辑 规则
export function useMock() {
  const { t } = useI18n()
  const formList = [
    {
      customName: '收货人',
      fieldCode: 'contactsName',
      fieldTypeCode: 'TEXT',
      editableAddFlag: true,
      editableUpdateFlag: true,
      requiredFlag: true,
      displayFlag: true,
      presetFlag: true
    },
    {
      customName: '收货电话',
      fieldCode: 'phone',
      fieldTypeCode: 'TEXT',
      editableAddFlag: true,
      editableUpdateFlag: true,
      requiredFlag: true,
      displayFlag: true,
      presetFlag: true
    },
    {
      customName: '国家',
      fieldCode: 'countryCode',
      fieldTypeCode: 'LOV_SELECT',
      editableAddFlag: false,
      editableUpdateFlag: false,
      requiredFlag: true,
      displayFlag: true,
      presetFlag: true,
      lovCode: 'ZIAM.LOCALE',
      defaultLovValueCode: 'CHN'
    },
    {
      customName: '收货地区',
      fieldCode: 'addressCode',
      displayFormat: 'FOUR_LEVEL',
      fieldTypeCode: 'TEXT',
      editableAddFlag: true,
      editableUpdateFlag: true,
      requiredFlag: true,
      displayFlag: true,
      presetFlag: true
    },
    {
      customName: t('keys.street'),
      fieldCode: 'street',
      fieldTypeCode: 'TEXTAREA',
      editableAddFlag: true,
      editableUpdateFlag: true,
      requiredFlag: true,
      displayFlag: true,
      presetFlag: true,
      textLengthLimit: '100'
    },
    {
      customName: '地址使用范围',
      fieldCode: 'defultReceiveFlag',
      fieldTypeCode: 'TEXT',
      editableAddFlag: true,
      editableUpdateFlag: true,
      requiredFlag: false,
      displayFlag: true,
      presetFlag: true
    }
  ]

  const agencySetformList = [
    {
      label: t('keys.Process_agent'),
      field: 'enableFlag',
      component: 'Radio',
      options: enableOptions(),
      componentProps: {}
    },
    {
      label: t('keys.agent'),
      field: 'empList',
      component: 'ZcbSelect',
      componentProps: {
        config: {
          lovViewCode: 'ZEMD.TENANT_EMP_VIEW', // 值集视图CODE
          keyId: 'empId', // 多选根据id选择  默认key id
          showKey: 'empName', // 显示key
          params: { filterFlag: true }
        }
      }
      // component: 'pageSelect',
      // componentProps: {
      //   clearable: true,
      //   disabled: false,
      //   assignment: 'replaceId',
      //   keyName: 'empName',
      //   keyValue: 'empId',
      //   optionkeyName: ['empName', 'empNum'],
      //   opsName: '', //  编辑回显list数据option的key的值
      //   opsValue: '', // 编辑回显list数据option的value的key的值
      //   Url: `/zemd/v1/${getTenantId()}/emp`,
      //   params: {}
      // }
    },
    {
      label: t('keys.period_of_procuration'),
      field: 'dataTime',
      component: 'DatePicker',
      componentProps: {}
    },
    {
      label: t('keys.reason'),
      field: 'remark',
      component: 'Input',
      placement: 'bottom',
      componentProps: {
        type: 'textarea',
        maxlength: '200',
        showWordLimit: true
      }
    }
  ]
  return {
    formList,
    agencySetformList
  }
}
